import { request } from '@/utils/requestWrapper';
import type { API } from '@/backend/typings';
import { tokenStore } from "@/store/tokenStore";

const tokenStoreInstance = tokenStore();

/** 新增售后服务 POST /api/afterSalesService/add */
export async function addAfterSalesServiceUsingPost(
  body: API.AfterSalesServiceAddRequest,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseLong_>({
    url: "/api/afterSalesService/add",
    method: "POST",
    data: body,
    header: {
      "Content-Type": "application/json",
      'Authorization': tokenStoreInstance.getToken,
    },
    ...options
  });
}

/** 删除售后服务 POST /api/afterSalesService/delete */
export async function deleteAfterSalesServiceUsingPost(
  body: API.DeleteRequest,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseBoolean_>({
    url: "/api/afterSalesService/delete",
    method: "POST",
    data: body,
    header: {
      "Content-Type": "application/json",
      'Authorization': tokenStoreInstance.getToken,
    },
    ...options
  });
}

/** 取消售后服务 POST /api/afterSalesService/cancel */
export async function cancelAfterSalesServiceUsingPost(
  body: API.DeleteRequest,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseBoolean_>({
    url: "/api/afterSalesService/cancel",
    method: "POST",
    data: body,
    header: {
      "Content-Type": "application/json",
      'Authorization': tokenStoreInstance.getToken,
    },
    ...options
  });
}

/** 编辑售后服务 POST /api/afterSalesService/edit */
export async function editAfterSalesServiceUsingPost(
  body: API.AfterSalesServiceEditRequest,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseBoolean_>({
    url: "/api/afterSalesService/edit",
    method: "POST",
    data: body,
    header: {
      "Content-Type": "application/json",
      'Authorization': tokenStoreInstance.getToken,
    },
    ...options
  });
}

/** 获取售后服务详情 GET /api/afterSalesService/get/vo */
export async function getAfterSalesServiceVoByIdUsingGet(
  params: API.getAfterSalesServiceVOByIdUsingGETParams,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseAfterSalesServiceVO_>({
    url: "/api/afterSalesService/get/vo",
    method: "GET",
    params,
    header: {
      'Authorization': tokenStoreInstance.getToken,
    },
    ...options
  });
}


/** 分页获取我的售后服务列表 POST /api/afterSalesService/my/list/page/vo */
export async function listMyAfterSalesServiceVoByPageUsingPost(
  body: API.AfterSalesServiceQueryRequest,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponsePageAfterSalesServiceVO_>({
    url: "/api/afterSalesService/my/list/page/vo",
    method: "POST",
    data: body,
    header: {
      "Content-Type": "application/json",
      'Authorization': tokenStoreInstance.getToken,
    },
    ...options
  });
}
